
// 监听函数
$().ready(function () {
    Lord();
    GetUserPhone();
    SetReport();
    JoioAL();
});

function Lord() {
    var str = location.search;
    str = str.substr(0);
    console.log(2);
    $.ajax({
        url: 'RcarpoolingDeails.ashx',
        data: { change: 1},
        type: 'POST',
        success: function (data) {
            console.log(data);
            var UserIDJM = (data.UserID).substring(0, 3) + "......" + (data.UserID).substring(data.UserID.length - 3, data.UserID.length);
            console.log(UserIDJM);

            var $li = $("<div id= \"Subject\">" +
                "<div id = \"SubjectOne\">" +
                "<div id=\"SubjectOneOne\">" +
                "<label for=\"\" class=\"LableOneType\">信息状态：</label>" +
                "<label for=\"\" id=\"ListStatus\">" + data.LStatus + "</label>" +
                "<img id=\"ReportImg\" src=\"images/report.png\" alt=\"\"><a href=\"#\" id=\"ReportHref\">举报此信息</a>" +
                "</div>" +
                "<div id=\"SubjectOneTwo\">" +
                "<label for=\"\" class=\"LableOneType\">出发城市：</label>" +
                "<label id=\"DepartureCity\">" + data.LGoCity + "</label>" +
                "<img id=\"carOneLogo\" src=\"images/daoda.png\" alt=\"\">" +
                "<label id=\"DestinationCity\" class=\"LableOneType\">目的地城市：</label>" +
                "<label id=\"DestinationCity_true\">" + data.LDesitination + "</label>" +
                "</div>" +

                "<div id=\"SubjectOneThere\">" +
                "<label for=\"\" class=\"LableOneType\">出发时间:</label>" +
                "<img src=\"images/Clock.jpg\" id=\"ClockImg\" alt=\"\">" +
                "<label for=\"\" id=\"DepartureTime\">" + data.LGoDate + "</label>" +
                "</div>" +
                "</div>" +

                "<div id=\"hrOne\"></div>" +

                "<div id=\"SubjectTwo\">" +
                "<div id=\"SubjectTwoOne\" class=\"gird-cell-1\">" +

                "<label for=\"\" class=\"LableOneType\">可容纳人数：</label><label id=\"CapacityOne\" for=\"\">" + data.LContain + "</label><br>" +
                "<label for=\"\" class=\"LableOneType\">汽车类型：</label><label id=\"CarType\" for=\"\">" + data.LCarType + "</label>" +
                "</div>" +

                "<div id=\"SubjectTwoTwo\" class=\"gird-cell-1\">" +
                "<label for=\"\" class=\"LableOneType\">已报名人数：</label><label for=\"\" id=\"PeploNumber\">" + data.SQMan + "</label><br>" +
                "<label for=\"\" class=\"LableOneType\">费用方式：</label><label id=\"CostMethodLable\" for=\"\">" + data.LCost + "</label>" +
                "</div>" +

                "<div id=\"SubjectTwoThere\" class=\"gird-cell-1\">" +
                "<label for=\"\" class=\"TextST\">已有</label><label for=\"\" id=\"SNumberPepole\"> " + data.LPPeople + " </label><label for=\"\" class=\"TextST\">人加入拼车</label><br>" +
                "</div>" +


                "</div>" +



                "<div id=\"SubjectThere\">" +
                "<img src=\"images/car_1.jpg\" id=\"carTwoLogo\" alt=\"\">" +
                "<label for=\"\" class=\"LableOneType\" id=\"OOAV\">车主留言:</label><br>" +
                "<label id=\"Describe\" for=\"\">" + data.LCWord + "</label><br>" +
                "<button id=\"JoinBtn\" >申请加入</button>" +
                "<button id=\"GetPhone\" value=\"" + data.UserID + "\" onclick=\"return false\">获取车主联系方式</button>" +
                "</div>" +
                "<div id=\"SubjectFour\">" +
                "<div id=\"SubjectFourLeft\" class=\"gird-cell-1\">" +
                "<label for=\"\" id=\"UserID\" value=\"\">发布用户：" + UserIDJM + "</label>" +
                "<label for=\"\">诚信指数：</label><label for=\"\" id=\"IntegrityIndicators\"><img src=\"\" alt=\"\">诚信指数高</label>" +
                "<label for=\"\" id=\"ReleaseTime\">发布时间：" + data.LPTime + "</label>" +
                "</div >" +
                "<div id=\"SubjectFourRight\" class=\"gird-cell-1\">" +
                "<label for=\"\">认证情况：</label><label for=\"\" id=\"SafetyLevel\">三级认证</label>" +
                "<label for=\"\" id=\"JoinCarID\">拼车编号：" + data.LongID + "</label>" +
                "<label for=\"\" id=\"SeeNumber\">浏览人数：" + data.LBPeople + "</label>" +
                "</div>" +
                "</div>" +

                "<div id=\"SubjectFive\">" +
                "<img src=\"images/jiaimegs.jpg\" id=\"AddZF\" alt=\"\">" +
                "<label for=\"\" id=\"SubjectFiveOne\">分享到：</label>" +
                "<a href=\"#\"><img src=\"images/RR.jpg\" id=\"AddRR\" alt=\"\"></a>" +
                "<a href=\"#\"> <img src=\"images/Weibo.jpg\" id=\"AddWeibo\" alt=\"\"></a>" +
                "<a href=\"#\"><img src=\"images/QQkj.jpg\" id=\"AddQQ\" alt=\"\"></a>" +
                "<label for=\"\" id=\"AddLable\">成功分享后将此消息【置顶】</label>" +
                "</div>" +
                "</div>");
            $("#ajaxOne").append($li);
        }
    });
}
// 举报信息
function SetReport()
{
    $("#ajaxOne").on("click", "#ReportHref",function(){
        if(confirm("确定删除吗？"))
        {
            console.log(1);
        }
        else
        {
            console.log(2);
        }
    });
}

//神奇加入
function JoioAL()
{
    $("#ajaxOne").on("click", "#JoinBtn", function () {
        var arr = $("#JoinCarID").text().split('：');
        $.ajax({
            url: 'RcarpoolingDeails.ashx',
            data: { change: 2, LongID: arr[1] },
            type: 'POST',
            success: function (data)
            {
                if (data == 1) {
                    alert("您成功加入该拼车订单");
                    location.href = "Homepage.aspx";
                }
                else
                {
                    alert("不明原因错误，请联系管理员");
                }
            }
        });
    });
}

// 获取车主电话
function GetUserPhone()
{
    $("#ajaxOne").on("click","#GetPhone",function () {
        alert($(this).val());
    });
}